import pandas as pd
from matplotlib import pyplot as plt
import matplotlib

matplotlib.rc("font", family='Source Han Sans CN', weight="regular", size="10")

file_path = "csv/books.csv"
df = pd.read_csv(file_path)

year_count = df.groupby(by="original_publication_year")["book_id"].count()

plt.figure(figsize=(20, 8), dpi=80)

plt.xlabel("年份")
plt.ylabel("数量")
plt.title("各年份出版书籍数量变化统计图", weight="bold", size="16")
plt.xticks(range(len(year_count.index))[::10], year_count.index[::10])

plt.plot(range(len(year_count.index)), year_count.values)
plt.show()
